import { request } from './request.js';

/**
 * 按年月查询预算
 * @param {Number} year - 年份
 * @param {Number} month - 月份
 * @returns {Promise} - 返回请求Promise
 */
export function getBudgetByYearMonth(year, month) {
    return request({
        url: '/budget/yearMonth',
        method: 'GET',
        data: {
            year,
            month
        }
    });
}

/**
 * 添加预算
 * @param {Object} budget - 预算对象
 * @returns {Promise} - 返回请求Promise
 */
export function addBudget(budget) {
    return request({
        url: '/budget/add',
        method: 'POST',
        data: budget
    });
}

/**
 * 删除预算
 * @param {Number} id - 预算ID
 * @returns {Promise} - 返回请求Promise
 */
export function deleteBudget(id) {
    return request({
        url: `/budget/${id}`,
        method: 'DELETE'
    });
}

/**
 * 更新预算
 * @param {Object} budget - 预算对象
 * @returns {Promise} - 返回请求Promise
 */
export function updateBudget(budget) {
    return request({
        url: '/budget/update',
        method: 'POST',
        data: budget
    });
}